﻿using MF.HSD.UpdateSalePriceListIspBP;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.Engine.Builder;
using UFSoft.UBF.UI.WebControlAdapter;

namespace MF_HSD_UIPlug.VoucherMainFormWebPart
{
    public partial class VoucherMainFormWebPartExtend : UFSoft.UBF.UI.Custom.ExtendedPartBase
    {

        public override void AfterInit(UFSoft.UBF.UI.IView.IPart part, EventArgs args)
        {
            this.Do_AfterInit(part, args); ;
        }

        #region 字段与属性                                       
        private UFIDA.U9.FI.GL.Voucher.VoucherUIModel.VoucherMainFormWebPart _strongPart;
        IUFButton btnCreate = new UFWebButtonAdapter();
        //IUFButton btnCreateReback = new UFWebButtonAdapter();
        #endregion
        private void Do_AfterInit(UFSoft.UBF.UI.IView.IPart part, EventArgs args)
        {
            #region 获取相关强类型数据                               

            _strongPart = part as UFIDA.U9.FI.GL.Voucher.VoucherUIModel.VoucherMainFormWebPart;
            if (_strongPart == null)
                return;
            //初始化按钮

            btnCreate.Text = "内部交易";
            btnCreate.ID = "btnCreateVC";
            btnCreate.AutoPostBack = true;
            IUFCard card = (IUFCard)_strongPart.GetUFControlByName(_strongPart.TopLevelContainer, "Container5");//Card17
            card.Controls.Add(btnCreate);
            CommonFunction.Layout(card, btnCreate, 20, 0);   //一般为从左往右按钮个数乘以2
            btnCreate.Click += new EventHandler(btnCreate_Click);


            //btnCreateReback.Text = "内部交易回调";
            //btnCreateReback.ID = "btnCreateReback";
            //btnCreateReback.Visible = false;
            //btnCreateReback.AutoPostBack = true;
            //card.Controls.Add(btnCreateReback);
            //CommonFunction.Layout(card, btnCreateReback, 22, 0);   //一般为从左往右按钮个数乘以2
            //btnCreateReback.Click += new EventHandler(btnCreateReback_Click);
            #endregion
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            _strongPart.OnDataCollect(this);
            _strongPart.IsDataBinding = true; //当前事件执行后会进行数据绑定
            _strongPart.IsConsuming = false;
            string formID = string.Empty;
            NameValueCollection param = new NameValueCollection();
            string FormID = "76562a63-80cd-4d19-887e-22332f4a06e1";
            _strongPart.ShowAtlasModalDialog(FormID, "内部交易", "688", "464", null, param, true, true, false);

        }
        private void btnCreateReback_Click(object sender, EventArgs e)
        {
            //_strongPart.Action.NavigateAction.Refresh(null, true);
        }
    }
}
